<?php 

class Event_CategoryForm extends Crud_Event_Handler
{
	protected $_type = 'form';
	
	/**
	 * Run handler with options array.
	 * 
	 * @param ProductCategoryRow $row
	 * @return void
	 */
	public function run($form)
	{

		$element = $form->getElement('template');
		$element->setRequired(0);

		$this->_attrcat($form);

		$decoratorScript = new Zend_Form_Decorator_ViewScript();
		$decoratorScript->setViewScript('product-category/form.phtml');
		$form->setDecorators(array(
			new Zend_Form_Decorator_PrepareElements(),
			$decoratorScript,
		));
		
	}

	protected function _attrcat($form)
	{
		$e = new Zend_Form_Element('attendant_category');

		$decoratorScript = new Zend_Form_Decorator_ViewScript();
		$decoratorScript->setViewScript('product-category/element_attendant_category.phtml');
	    $e->setDecorators(array(
	        new Zend_Form_Decorator_PrepareElements(),
	    	$decoratorScript,
	    ));

		$form->addElement($e);
	}
}